#define _CRT_SECURE_NO_WARNINGS 1
#include "TopK.h"

void test()
{
	HP hp;
	HeapInit(&hp);
	int a[] = { 14,54,787,5155,21,61,45,889,10 };
	int len = sizeof(a) / sizeof(int);
	for (int i = 0; i < len; i++)
	{
		HeapPush(&hp, a[i]);
	}

	int n = 0;
	scanf("%d", &n);

	assert(n <= hp.size);
	for (int i = 0; i < n; i++)
	{
		int top = HeapTop(&hp);
		printf("%d\n", top);
		HeapPop(&hp);
	}
}

int main()
{
	test();
	return 0;
}